/**
 * @param {number} area
 * @return {number[]}
*/
var constructRectangle = function(area) {
  let map = new Map();
  map.set(area, 1);
  for(let i = 2; i <= area / 2; i++) {
    if(area % i == 0 && !map.has(area / i) && area / i >= i) {
      map.set(area / i, i);
    }
  }
  let arr = [...map];
  return arr[arr.length - 1];
};
let area = 4;
console.log(constructRectangle(area));
area = 37;
console.log(constructRectangle(area));
area = 122122;
console.log(constructRectangle(area));
